/**
 * This is my code.
 *
 * $Id$
 */
package fi.jab.esb.config.xml.impl;

import fi.jab.esb.config.xml.Schedule;
import fi.jab.esb.config.xml.ScheduleProviderType;
import fi.jab.esb.config.xml.XmlPackage;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.util.BasicFeatureMap;
import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Schedule Provider Type</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link fi.jab.esb.config.xml.impl.ScheduleProviderTypeImpl#getScheduleGroup <em>Schedule Group</em>}</li>
 *   <li>{@link fi.jab.esb.config.xml.impl.ScheduleProviderTypeImpl#getSchedule <em>Schedule</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ScheduleProviderTypeImpl extends ProviderImpl implements ScheduleProviderType
{
  /**
   * The cached value of the '{@link #getScheduleGroup() <em>Schedule Group</em>}' attribute list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getScheduleGroup()
   * @generated
   * @ordered
   */
  protected FeatureMap scheduleGroup;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected ScheduleProviderTypeImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return XmlPackage.Literals.SCHEDULE_PROVIDER_TYPE;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public FeatureMap getScheduleGroup()
  {
    if (scheduleGroup == null)
    {
      scheduleGroup = new BasicFeatureMap(this, XmlPackage.SCHEDULE_PROVIDER_TYPE__SCHEDULE_GROUP);
    }
    return scheduleGroup;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Schedule> getSchedule()
  {
    return getScheduleGroup().list(XmlPackage.Literals.SCHEDULE_PROVIDER_TYPE__SCHEDULE);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case XmlPackage.SCHEDULE_PROVIDER_TYPE__SCHEDULE_GROUP:
        return ((InternalEList<?>)getScheduleGroup()).basicRemove(otherEnd, msgs);
      case XmlPackage.SCHEDULE_PROVIDER_TYPE__SCHEDULE:
        return ((InternalEList<?>)getSchedule()).basicRemove(otherEnd, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case XmlPackage.SCHEDULE_PROVIDER_TYPE__SCHEDULE_GROUP:
        if (coreType) return getScheduleGroup();
        return ((FeatureMap.Internal)getScheduleGroup()).getWrapper();
      case XmlPackage.SCHEDULE_PROVIDER_TYPE__SCHEDULE:
        return getSchedule();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case XmlPackage.SCHEDULE_PROVIDER_TYPE__SCHEDULE_GROUP:
        ((FeatureMap.Internal)getScheduleGroup()).set(newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case XmlPackage.SCHEDULE_PROVIDER_TYPE__SCHEDULE_GROUP:
        getScheduleGroup().clear();
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case XmlPackage.SCHEDULE_PROVIDER_TYPE__SCHEDULE_GROUP:
        return scheduleGroup != null && !scheduleGroup.isEmpty();
      case XmlPackage.SCHEDULE_PROVIDER_TYPE__SCHEDULE:
        return !getSchedule().isEmpty();
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (scheduleGroup: ");
    result.append(scheduleGroup);
    result.append(')');
    return result.toString();
  }

} //ScheduleProviderTypeImpl
